import { BasicColumn, FormSchema } from '@/components/Table';
import { getAllRoleList } from '@/api/demo/system';

import {optionsListApi} from "@/api/demo/select";

type CheckedType = boolean | string | number;
export const columns: BasicColumn[] = [
  {
    title: '账号名称',
    dataIndex: 'userName',
    width: 200,
  },
  {
    title: '角色值',
    dataIndex: 'roleValue',
    width: 180,
  },
  {
    title: '状态',
    dataIndex: 'state',
    width: 80,
    format: text => {
      let v="";
      switch (text) {
        case 0:
          v="冻结";
          break;
        case 1:
          v="正常";
          break;
      }
      return v;
    }
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '搜索',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '账号名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'passWord',
    label: '密码',
    component: 'InputPassword',
    componentProps:{
      placeholder:"不填时不修改密码,新增时需要填写!"
    },
    required: false,
  },
  {
    field: 'roleValue',
    label: '角色值',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      api: getAllRoleList,
      resultField: 'data',
      labelField: 'roleValue',
      valueField: 'roleValue',
    },
  },




];
